import Vue from "vue";
import VueRouter from "vue-router";
import Home from "../views/Home.vue";
import Layout from  "../components/layOut"
import childView from "../components/childView"
Vue.use(VueRouter);

/*
* @Author: ZhangJiangPeng
* @Date: 2024-04-10 09:39:20
* @Description:  vue-router重写push方法，解决相同路径跳转报错
*/
const VueRouterPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(to) {
	return VueRouterPush.call(this, to).catch(err => err)
}


const routes = [
  {
    path: '/',
    component: Layout,
    hidden: true,
    children: [
      {
        path: "",
        name: "Home",
        component: () => import('@/views/Home.vue'),
      },
      {
        path: "pathPage",
        name: "inform",
        component: childView,
        children:[
          {
            path: "detail/:id",
            name: "detail",
            component: () => import('@/views/detail.vue'),
          },
          {
            path: "company-info",
            name: "company-info",
            component: () => import('@/views/company-info.vue'),
          },
          {
            path: "article/:id",
            name: "article",
            component: () => import('@/views/inform.vue'),
          },
          {
            path: "test/:id",
            name: "test",
            component: () => import('@/views/wonderful.vue'),
          },
          {
            path: "mydetail/:id",
            name: "mydetail",
            component: () => import('@/views/mydetail.vue'),
          },
          {
            path: "news/:id",
            name: "news",
            component: () => import('@/views/fileDownLoad.vue'),
          },
          {
            path: "manual/:id",
            name: "manual",
            component: () => import('@/views/contact.vue'),
          },

        ]
      },
      {
        path: "searchResult",
        name: "searchResult",
        component: () => import('@/views/searchResult.vue'),
      },
      {
        path: "singlePage",
        name: "singlePage",
        component: () => import('@/views/singlePage.vue'),
      },
    ]
  },
];



const router = new VueRouter({
  routes,
});

router.beforeEach((to, from, next) => {

  next()
})

export default router;
